package ws.very.util.akka.util

import akka.actor.ActorSystem
import ws.very.util.lang.ShutDownAction

trait AkkaSystemable {

  implicit def system: ActorSystem

}
trait AutoShutdownAkkaSystem extends AkkaSystemable with Confable {
  ShutDownAction + {
    if (system != null)
      system.shutdown
  }
}

trait AkkaSystemWithName extends AutoShutdownAkkaSystem {
  def systemName: String
  implicit lazy val system: ActorSystem = ActorSystem(systemName)
}

